<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>小说,小说网-纵横中文网|最热门的免费小说网</title>
  <link rel="shortcut icon" href="https://static.zongheng.com/favicon.ico"/>
  <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1" />
  <meta name="renderer" content="webkit" />
  <meta name="keywords" content="小说,小说网,免费小说,纵横中文网" />
  <meta name="description" content="纵横中文网,最热门的免费小说网站,提供玄幻小说、网游小说、言情小说、穿越小说、都市小说等免费小说在线阅读与下载。大神作品齐聚纵横,最新章节每日更新。" />
  <link rel="stylesheet" type="text/css" th:href="@{/css/passport.css}" />
  <link rel="stylesheet" type="text/css" href="https://www.layuicdn.com/layui-v2.6.8/css/layui.css" />
  <script type="text/javascript" src="https://www.layuicdn.com/layui-v2.6.8/layui.js"></script>
  <script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>


</head>

<body data-cpt3="1" data-cpt3app="FFFF0N00000000006BA5" data-cpt3scene="ic_login">

<div class="wrap pass_header">
  <div class="pass_logo">
    <a th:href="@{/index}" ><img th:src="@{/picture/logo.png}" alt="" src="/picture/logo.png"/></a>
  </div>
  <div class="pass_link">
    没有账号 <a th:href="@{/signin}">注册</a>
  </div>
</div>
<div class="passbg">
  <div class="wrap">
    <div class="pass_ad">
      <a th:href="@{/index}" title="" target="_blank"><img th:src="@{/picture/enterzh.png}" width="560" height="410" alt="" src=""></a>
    </div>
    <div class="login box">
      <div class="comlogin" id="nloginType_comm">
        <div class="login-style">
          <span class="login-s-msg fl login-s-active data-feeler" clkseed="ACCOUNT-TAB">账号密码登录</span>
          <span class="login-s-line"></span><span class="login-s-user fr data-feeler wait" clkseed="ACCOUNT-TAB">短信快速登录</span>
        </div>
        <div class="cl0"></div>
        <form class="layui-form" onsubmit="return false">
          <div class="login-box" style="display: block;">
            <p class="layui-form-item">
              <label>
                <input type="text" name="username" lay-verify="required" lay-reqtext="账号是必填项，岂能为空？" placeholder="&#xe66f; 输入账号" autocomplete="off" class="layui-input layui-icon"/>
              </label>
            </p>
            <p class="layui-form-item">
              <label>
                <input type="password" name="password" lay-verify="required" lay-reqtext="密码是必填项，岂能为空？" placeholder="&#xe673; 输入密码" autocomplete="off" class="layui-input layui-icon">
              </label>
            </p>
            <p class="layui-form-item">
              <label>
                <input type="text" name="captcha" lay-verify="required" lay-reqtext="验证码必填项，岂能为空？" placeholder="&#xe679; 输入验证码" autocomplete="off" class="layui-input layui-icon layui-input-inline">
              </label>
              <img class="layui-form-mid" src="/captcha" width="130px" height="38px" style="padding: 0px 0!important"/>
            </p>
            <div class="layui-form-item">
              <div class="layui-input-inline">
                <input type="checkbox" name="remember" title="记住我" >
              </div>
              <div class="layui-form-mid" style="float: right">
                <a href="#" class="wait" style="color: #777777">忘记密码</a>
              </div>
            </div>
            <input type="submit" class="btn-submit btn-red submit-user" lay-submit lay-filter="form" value="登录" />
          </div>
        </form>
      </div>
      <div class="cl0"></div>
    </div>
  </div>
  <div class="cl0"></div>
  <div class="cl15"></div>
</div>
<script type="text/javascript" th:src="@{/js/prompt.js}"></script>
<script>
  layui.use(['form','layer'], function(){
    var form = layui.form;
    //监听提交
    form.on('submit(form)', function(data){
      let token = getCookie("XSRF-TOKEN");
      $.ajax({
        url: "/login",
        type: "POST",
        data: {"username": data.field.username,"password":data.field.password,
          "captcha":data.field.captcha, "remember": data.field.remember, "_csrf": token},
        dataType: 'json',
        success: function (res) {
          if (res.status===200){
            layer.msg(res.msg, {icon: 6});
            window.location.href = "/";
          }else {
            layer.msg(res.msg, {icon: 5,anim: 6});
          }
        }
      });
      return false;
    });
  });
  function getCookie(name){
    var strcookie = document.cookie;//获取cookie字符串
    var arrcookie = strcookie.split("; ");//分割
    //遍历匹配
    for ( var i = 0; i < arrcookie.length; i++) {
      var arr = arrcookie[i].split("=");
      if (arr[0] === name){
        return arr[1];
      }
    }
    return "";
  }
</script>
</body>
</html>